import 'babel-polyfill'
import promise from 'es6-promise'
promise.polyfill()

import Vue from 'vue'

import ElementUI from 'element-ui'
// import 'element-ui/lib/theme-chalk/index.css'
import '@/assets/styles/theme-default/index.scss'

import RouterTab from 'vue-router-tab'
import 'vue-router-tab/dist/lib/vue-router-tab.css'

import App from './App'
import store from './store'
import router, { resetRouter } from './router'

import gcStarterUi, { $gc } from 'gc-starter-ui-plus'

import '@/permission' // permission control
import { sha256 } from 'js-sha256'

/**
 * mock，生产环境不需要
 */
// import { mockXHR } from '../mock'
// mockXHR()

Vue.use(ElementUI, { size: 'small' })
Vue.use(RouterTab)
Vue.use(gcStarterUi)
import supportIE from '../node_modules/gc-starter-ui-plus/packages/utils/supportPlaceholder' // IE placeholder兼容指令

Vue.use(supportIE)
Vue.mixin($gc.mixins.userMixins)

Vue.config.productionTip = false

// 挂载全局
Vue.prototype.$resetRouter = resetRouter
Vue.prototype.isAuth = $gc.isAuth // 权限方法
Vue.prototype.$get = $gc.get // http.get
Vue.prototype.$post = $gc.post // http.post
Vue.prototype.$put = $gc.put // http.put
Vue.prototype.$del = $gc.del // http.delete
Vue.prototype.$wrapUrl = $gc.wrapUrl // 包装uri
Vue.prototype.$cookie = $gc.$cookie
Vue.prototype.inputChange = function(e) { // 兼容ie下双向绑定事件
  return e.target.value
}
Vue.prototype.msgEncode = function(message, salt) {
  return sha256(sha256(message) + salt)
}
new Vue({
  el: '#app',
  router,
  store,
  render: h => h(App)
})
